#ifndef NDMUTEX_H
#define NDMUTEX_H


#include <windows.h>


#define ERR_NDMUTEX_ALREADYINIT	 		-1
#define ERR_NDMUTEX_NOTINIT				-2
#define ERR_NDMUTEX_CANTCREATEMUTEX		-3

class NDMutex
{
public:
	NDMutex();
	~NDMutex();

	int 	Init();
	int	 	Lock();
	int 	Unlock();
	bool 	IsInitialized();
private:
#ifdef NDMUTEX_CRITICALSECTION
	CRITICAL_SECTION 		m_mutex;
#else
	HANDLE 					m_mutex;
#endif//NDMUTEX_CRITICALSECTION
	bool 				    m_bInited;
};


#endif//NDMUTEX_H
